package com.matrix.java.chap_05;

import java.util.Scanner;

/*
    计算最大公约教
 */
public class Ex5_14 {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        System.out.print("数1: ");
        int num1 = input.nextInt();
        System.out.print("数2: ");
        int num2 = input.nextInt();
        int d = Math.min(num1, num2);
        for (int i = d; i >0; i--) {
            if (num1%i==0&&num2%i==0){
                System.out.println(i);
                break;
            }
        }
        input.close();
    }
}
